home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13313 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  49 lines

  1. Path: uxa.ecn.bgu.edu!ujdeutsc
  2. From: ujdeutsc@uxa.ecn.bgu.edu (Deutsch Joseph)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Looking for a clear screen function
  5. Date: 6 Apr 1996 06:25:42 GMT
  6. Organization: Educational Computing Network
  7. Message-ID: <4k52p6$5d9@news.ecn.bgu.edu>
  8. References: <4gaeba$d9h@nkosi.well.com> <3129AC77.5F25@fokus.gmd.de> <TANMOY.96Feb20084655@qcd.lanl.gov> <312AC84A.3D66@connix.com>
  9. NNTP-Posting-Host: ecom4.ecn.bgu.edu
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Scott Hawley (shawley@connix.com) wrote:
  13. : Actually you should use at least 50 instead of 25. If the cursor is at 
  14. : the top of a 25 line screen the first 25 lines will only bring it to the 
  15. : bottom.
  16.  
  17.  
  18. You can also try the system() function, which is a part of the ANSI C 
  19. library. Its argument is the OS command for clearing the screen on the 
  20. particular machine that the program is running on. Thus, on DOS machines 
  21. you would use:
  22.  
  23.    system("cls");
  24.  
  25. and on most UNIX machines you would use:
  26.  
  27.    system("clear");
  28.  
  29. The real advantage to this method is that it clears the screen regardless 
  30. of monitor size. For greater programming convenience, you could use 
  31. conditional compiliation directives such as:
  32.  
  33. #ifdef DOS
  34.    #define CLEARMSG  "cls"
  35. #endif
  36. #ifdef UNIX
  37.    #define CLEARMSG  "clear"
  38. #endif
  39.  
  40. with system( CLEARMSG ); to handle the differences between the two OS's 
  41. with relative ease.
  42. --
  43. __________________________________________________________________________
  44.                           |
  45.                           |                    |
  46.     Joseph Deutsch        |          Ceci n'est pas une pipe.
  47.                           |
  48. __________________________|_______________________________________________
  49.